package com.emergency.assist.dao;

import com.emergency.assist.domain.RoutePoint;
import com.emergency.assist.domain.RouteRelation;
import org.hibernate.annotations.Parameter;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/*
*
 * Created by qiuyan.pei on 2020/3/12.
*/


public interface RoutePointDao extends JpaRepository<RoutePoint,Long> , JpaSpecificationExecutor<RoutePoint> {

    @Query("select count(rp) from RoutePoint rp where route.id=:routeId")
    int countByRoute(@Param("routeId") long routeId);

    @Query("select rp from RoutePoint rp where route.id=:routeId")
    List<RoutePoint> findAllByRoute(@Param("routeId") long routeId);
}
